//
//  User.swift
//  Xiaozihui
//
//  Created by 校企荟 on 2017/10/9.
//  Copyright © 2017年 校企荟. All rights reserved.
//

import UIKit

class User: NSObject,NSCoding {
    var id: String?
    var img: String?
    var license: String?
    var name: String?
    var password: String?
    var service: String?
    var style: String?
    var supplier: String?
    var tel: String?
    var tie: String?
    var token: String?
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
    }
    //解档
    required init?(coder aDecoder: NSCoder) {
        id = aDecoder.decodeObject(forKey: "id") as? String
        img = aDecoder.decodeObject(forKey: "img") as? String
        license = aDecoder.decodeObject(forKey: "license") as? String
        name = aDecoder.decodeObject(forKey: "name") as? String
        password = aDecoder.decodeObject(forKey: "password") as? String
        service = aDecoder.decodeObject(forKey: "service") as? String
        style = aDecoder.decodeObject(forKey: "style") as? String
        supplier = aDecoder.decodeObject(forKey: "supplier") as? String
        tel = aDecoder.decodeObject(forKey: "tel") as? String
        tie = aDecoder.decodeObject(forKey: "tie") as? String
        token = aDecoder.decodeObject(forKey: "token") as? String
    }
    //归档
    func encode(with aCoder: NSCoder) {
        aCoder.encode(id, forKey: "id")
        aCoder.encode(img, forKey: "img")
        aCoder.encode(license, forKey: "license")
        aCoder.encode(name, forKey: "name")
        aCoder.encode(password, forKey: "password")
        aCoder.encode(service, forKey: "service")
        aCoder.encode(style, forKey: "style")
        aCoder.encode(supplier, forKey: "supplier")
        aCoder.encode(tel, forKey: "tel")
        aCoder.encode(tie, forKey: "tie")
        aCoder.encode(token, forKey: "token")
    }
    
    init(dic:[String : Any?]) {
        super.init()
        setValuesForKeys(dic)
    }
}
